Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be clearer in definition of Inf and avoid relying on Modelica.Constants. #3612

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

HansOlsson
Copy link
Collaborator

@HansOlsson HansOlsson commented Nov 12, 2024

This is what I meant with inlining the definition of Modelica.Constants.inf.

For comparison:
In C:

In C++ (C++11 and later); https://en.cppreference.com/w/cpp/types/numeric_limits

  • std::numeric_limits::max() "returns the largest finite value of double"
  • std::numeric_limits::lowest() "returns the lowest finite value of double"

@@ -1500,6 +1500,12 @@ \subsection{Real Type}\label{real-type}
\index{unbounded@\robustinline{unbounded}!attribute of \robustinline{Real}}%
\index{stateSelect@\robustinline{stateSelect}!attribute of \robustinline{Real}}

The default \lstinline!min!- and \lstinline!max!-attributes do not constrain the value.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are default attributes? It can't be default values since there are no values assigned.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried to rewrite that, but still without introducing a special +Inf symbol.
If that fails we can just skip the last two commits.

@HansOlsson
Copy link
Collaborator Author

The non-normative comment:

The minimum representable floating point number is usually minus the maximum representable floating point number, and should not be confused with the minimum positive one.

is related to C++ having such a mismatched pair:

  • std::numeric_limits::max() "returns the largest finite value of double"
  • std::numeric_limits::lowest() "returns the lowest finite value of double"

but I think it is a general naming issue deserving of a comment, and not only a C/C++-problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants